package com.etnet.streamserver.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StrUtil {
    public static boolean isNumeric(String str) {
        if ((str != null) && (!str.equals(""))) {
            Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
            Matcher isNum = pattern.matcher(str);
            if (isNum.matches()) {
                return true;
            }
        }
        return false;
    }

    public static boolean isCharacter(String str) {
        if ((str != null) && (!str.equals(""))) {
            Pattern pattern = Pattern.compile("^[a-zA-Z]*$");
            return pattern.matcher(str).matches();
        }
        return false;
    }

    public static boolean isInteger(String str) {
        if ((str != null) && (!str.equals(""))) {
            Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
            return pattern.matcher(str).matches();
        }
        return false;
    }

    public static boolean isDouble(String str) {
        if ((str != null) && (!str.equals(""))) {
            Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
            return pattern.matcher(str).matches();
        }
        return false;
    }
}